@include('admin.header')

<style type="text/css">
  .opartion {
    width: 350px;
  }

  .pagination {
    list-style: none;
    float: right;
  }

  .pagination li {
    float: left;
    padding-left: 5px;
    padding-right: 5px;
  }

  .input_search {
    margin-top: 10px;
  }
</style>

<div class="wrap">
  <div class="margin-bottom-20">
    <!-- <a class="btn btn-primary edit"><i class="fa fa-plus"></i> 添加</a> -->
    {{ csrf_field() }}
    <input id="change_url" value="" type="hidden"/>
    <form action="" method="post">
        <div class="cl pd-5 bg-1 bk-gray mt-20">
            <span class="text-c">
            <input type="text" name="node_name" placeholder="用户名" style="width:250px" class="input-text input_search" value="{{$node_name}}">
            <button name="" id="search" class="btn btn-success user_search" type="
            submit"><i class="Hui-iconfont"></i> 搜索</button>
            </span>
            <span class="r">共有数据：<strong>{{$data->total()}}</strong> 条</span>
        </div>
    </form>
  </div>
  <form class="form-horizontal js-ajax-form" method="post" novalidate="novalidate">
    <table class="table table-hover table-bordered">
      <thead>
      <tr>
        <th width="100">分红ID号</th>
        <th>店铺ID号</th>
        <th>转账流水号</th>
        <th>分红用户ID号</th>
        <th>用户名</th>
        <th>分红总金额</th>
        <th>用户分红金额</th>
        <th>购买数量</th>
        <th>状态</th>
        <!-- <th class="opartion">操作</th> -->
      </tr>
      </thead>
      <tbody>
      @foreach($data as $val)
      <tr>
        <td>{{$val->id}}</td>
        <td>{{$val->shop_id}}</td>
        <td>{{$val->transfer_id}}</td>
        <td>{{$val->node_id}}</td>
        <td>{{$val->node_name}}</td>
        <td>{{$val->total_amount}}</td>
        <td>{{$val->amount}}</td>
        <td>{{$val->buy_count}}</td>
        <td>
          @if($val->status == 0)
            未转账
          @else if($val->status == 1)
            已转账
          @endif
        </td>
        <!-- <td>
          <a class="detail" _id="" >详情</a>
        </td> -->
      </tr>
      @endforeach
      </tbody>
    </table>

    <!-- 分页 -->
    @if (!empty($data))
    <div class="page_list">
        {{$data->links()}}
    </div>
    @endif
  </form>
</div>

<script>

  $.fn.setCursorPosition = function(position){ 
    if(this.lengh == 0) return this; 
    return $(this).setSelection(position, position); 
  } 
  $.fn.setSelection = function(selectionStart, selectionEnd) { 
    if(this.lengh == 0) return this; 
    input = this[0]; 
    if (input.createTextRange) { 
      var range = input.createTextRange(); 
      range.collapse(true); 
      range.moveEnd('character', selectionEnd); 
      range.moveStart('character', selectionStart); 
      range.select(); 
    } else if (input.setSelectionRange) { 
      input.focus(); 
      input.setSelectionRange(selectionStart, selectionEnd); 
    } 
    return this; 
  }
  //焦点定位到最后
  $.fn.focusEnd = function(){ 
    this.setCursorPosition(this.val().length); 
  }

  $(function(){
    //搜索框自动得到焦点(如果有内容，直接定位到内容最后)
    $('input[name=node_name]').focusEnd();
  });
</script>